<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" indent="yes"/>
    <xsl:param name="userId"/>
    <xsl:template match="/">
        <xsl:apply-templates/>
    </xsl:template>
    <xsl:template match="text()"/>
    <xsl:template name="comment" match="comments">
        <xsl:for-each select="comment">
            <li class="comment-item" data="comment-item">
                <xsl:attribute name="id">
                    <xsl:text>comment-item-</xsl:text><xsl:value-of select="commentid"/>
                </xsl:attribute>
                <div class="inline avatar">
                    <xsl:if test="avatarurl != ''">
                        <img src="{avatarurl}"/>
                    </xsl:if>
                    <xsl:if test="avatarurl = ''">
                        <img src="/images/default_avatar.png"/>
                    </xsl:if>
                </div>
                <div class="inline comment">
                    <div class="info">
                        <span class="user-name">
                            <xsl:value-of select="username"/>
                        </span>
                        <span>has posted</span>
                        <span class="update-time">
                            <xsl:value-of select="updatetime"/>
                        </span>
                        <xsl:if test="userid = $userId">
                            <div data="edit" class="edit">
                                Edit
                            </div>
                            <div data="delete" class="delete">
                                Delete
                            </div>
                        </xsl:if>
                    </div>
                    <div class="content">
                        <xsl:value-of select="content"/>
                    </div>
                </div>
            </li>
        </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>